var t = require("../../../@babel/runtime/helpers/interopRequireDefault").default,
  e = require("../../../@babel/runtime/helpers/defineProperty"),
  a = require("../../../utils/http"),
  i = t(require("../../../components/u-charts/u-charts.min")),
  n = new a.HTTP,
  r = {};
Page({
  data: {
    cWidth: 750,
    cHeight: 500,
    pixelRatio: 2
  },
  onLoad: function () {},
  onReady: function () {
    var t = 1 * wx.getSystemInfoSync().windowWidth,
      e = 500 / 750 * wx.getSystemInfoSync().windowWidth,
      a = wx.getSystemInfoSync().pixelRatio;
    this.setData({
        cWidth: t,
        cHeight: e,
        pixelRatio: a
      }),
      this.getServerData(),
      this.getServerData2(),
      this.getServerData3(),
      this.getServerData4(),
      this.getServerData5()
  },
  getServerData: function () {
    var t = this,
      e = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/funnel/department"
    }).then((function (a) {
      e.setData({
          client: a.data
        }),
        console.log(e.data.client, "client");
      var i = {
        series: [{
          name: "核名/新增",
          color: "#0089FF",
          data: t.data.client[0].mix / 100
        }]
      };
      t.drawCharts("one", i)
    }))
  },
  drawCharts: function (t, a) {
    var n = this;
    wx.createSelectorQuery().in(this).select("#" + t).fields({
      node: !0,
      size: !0
    }).exec((function (o) {
      if (o[0]) {
        var l,
          d = o[0].node,
          s = d.getContext("2d");
        d.width = o[0].width * n.data.pixelRatio,
          d.height = o[0].height * n.data.pixelRatio,
          r[t] = new i.default({
            type: "arcbar",
            context: s,
            width: n.data.cWidth * n.data.pixelRatio / 2,
            height: n.data.cHeight * n.data.pixelRatio / 2,
            series: a.series,
            pixelRatio: n.data.pixelRatio,
            animation: !0,
            padding: [10, 15, 25, 15],
            title: {
              name: n.data.client[0].mix + "%",
              fontSize: 18,
              color: "black"
            },
            subtitle: {
              name: "核名/新增",
              fontSize: 14,
              color: "#666666",
              offsetY: "8",
              offsetX: "6"
            },
            extra: {
              arcbar: (l = {
                type: "default",
                width: 5,
                backgroundColor: "#E9E9E9",
                startAngle: .75,
                endAngle: .25,
                gap: 2,
                linearType: "none"
              }, e(l, "startAngle", 1), e(l, "endAngle", 0), l)
            }
          })
      } else
        console.error("[uCharts]: 未获取到 context")
    }))
  },
  getServerData2: function () {
    var t = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/funnel/department"
    }).then((function (e) {
      t.setData({
        client: e.data
      });
      var a = {
        series: [{
          name: "核名/新增",
          color: "#0089FF",
          data: t.data.client[1].mix / 100
        }]
      };
      t.drawChart2("two", a)
    }))
  },
  drawChart2: function (t, a) {
    var n = this;
    wx.createSelectorQuery().in(this).select("#" + t).fields({
      node: !0,
      size: !0
    }).exec((function (o) {
      if (o[0]) {
        var l,
          d = o[0].node,
          s = d.getContext("2d");
        d.width = o[0].width * n.data.pixelRatio,
          d.height = o[0].height * n.data.pixelRatio,
          r[t] = new i.default({
            type: "arcbar",
            context: s,
            width: n.data.cWidth * n.data.pixelRatio / 2,
            height: n.data.cHeight * n.data.pixelRatio / 2,
            series: a.series,
            pixelRatio: n.data.pixelRatio,
            animation: !0,
            title: {
              name: n.data.client[1].mix + "%",
              fontSize: 18,
              color: "black"
            },
            subtitle: {
              name: "核名/新增",
              fontSize: 14,
              color: "#666666",
              offsetY: "8",
              offsetX: "6"
            },
            extra: {
              arcbar: (l = {
                type: "default",
                width: 5,
                backgroundColor: "#E9E9E9",
                startAngle: .75,
                endAngle: .25,
                gap: 2,
                linearType: "none"
              }, e(l, "startAngle", 1), e(l, "endAngle", 0), l)
            }
          })
      } else
        console.error("[uCharts]: 未获取到 context")
    }))
  },
  getServerData3: function () {
    var t = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/funnel/department"
    }).then((function (e) {
      t.setData({
        client: e.data
      });
      var a = {
        series: [{
          name: "核名/新增",
          color: "#0089FF",
          data: t.data.client[2].mix / 100
        }]
      };
      t.drawChart3("three", a)
    }))
  },
  drawChart3: function (t, a) {
    var n = this;
    wx.createSelectorQuery().in(this).select("#" + t).fields({
      node: !0,
      size: !0
    }).exec((function (o) {
      if (o[0]) {
        var l,
          d = o[0].node,
          s = d.getContext("2d");
        d.width = o[0].width * n.data.pixelRatio,
          d.height = o[0].height * n.data.pixelRatio,
          r[t] = new i.default({
            type: "arcbar",
            context: s,
            width: n.data.cWidth * n.data.pixelRatio / 2,
            height: n.data.cHeight * n.data.pixelRatio / 2,
            series: a.series,
            pixelRatio: n.data.pixelRatio,
            animation: !0,
            title: {
              name: n.data.client[2].mix + "%",
              fontSize: 18,
              color: "black"
            },
            subtitle: {
              name: "核名/新增",
              fontSize: 14,
              color: "#666666",
              offsetY: "8",
              offsetX: "6"
            },
            extra: {
              arcbar: (l = {
                type: "default",
                width: 5,
                backgroundColor: "#E9E9E9",
                startAngle: .75,
                endAngle: .25,
                gap: 2,
                linearType: "none"
              }, e(l, "startAngle", 1), e(l, "endAngle", 0), l)
            }
          })
      } else
        console.error("[uCharts]: 未获取到 context")
    }))
  },
  getServerData4: function () {
    var t = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/funnel/department"
    }).then((function (e) {
      t.setData({
        client: e.data
      });
      var a = {
        series: [{
          name: "核名/新增",
          color: "#0089FF",
          data: t.data.client[3].mix / 100
        }]
      };
      t.drawChart4("four", a)
    }))
  },
  drawChart4: function (t, a) {
    var n = this;
    wx.createSelectorQuery().in(this).select("#" + t).fields({
      node: !0,
      size: !0
    }).exec((function (o) {
      if (o[0]) {
        var l,
          d = o[0].node,
          s = d.getContext("2d");
        d.width = o[0].width * n.data.pixelRatio,
          d.height = o[0].height * n.data.pixelRatio,
          r[t] = new i.default({
            type: "arcbar",
            context: s,
            width: n.data.cWidth * n.data.pixelRatio / 2,
            height: n.data.cHeight * n.data.pixelRatio / 2,
            series: a.series,
            pixelRatio: n.data.pixelRatio,
            animation: !0,
            title: {
              name: n.data.client[3].mix + "%",
              fontSize: 18,
              color: "black"
            },
            subtitle: {
              name: "核名/新增",
              fontSize: 14,
              color: "#666666",
              offsetY: "8",
              offsetX: "6"
            },
            extra: {
              arcbar: (l = {
                type: "default",
                width: 5,
                backgroundColor: "#E9E9E9",
                startAngle: .75,
                endAngle: .25,
                gap: 2,
                linearType: "none"
              }, e(l, "startAngle", 1), e(l, "endAngle", 0), l)
            }
          })
      } else
        console.error("[uCharts]: 未获取到 context")
    }))
  },
  getServerData5: function () {
    var t = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/funnel/department"
    }).then((function (e) {
      t.setData({
        client: e.data
      });
      var a = {
        series: [{
          name: "核名/新增",
          color: "#0089FF",
          data: t.data.client[4].mix / 100
        }]
      };
      t.drawChart5("five", a)
    }))
  },
  drawChart5: function (t, a) {
    var n = this;
    wx.createSelectorQuery().in(this).select("#" + t).fields({
      node: !0,
      size: !0
    }).exec((function (o) {
      if (o[0]) {
        var l,
          d = o[0].node,
          s = d.getContext("2d");
        d.width = o[0].width * n.data.pixelRatio,
          d.height = o[0].height * n.data.pixelRatio,
          r[t] = new i.default({
            type: "arcbar",
            context: s,
            width: n.data.cWidth * n.data.pixelRatio / 2,
            height: n.data.cHeight * n.data.pixelRatio / 2,
            series: a.series,
            pixelRatio: n.data.pixelRatio,
            animation: !0,
            title: {
              name: n.data.client[4].mix + "%",
              fontSize: 18,
              color: "black"
            },
            subtitle: {
              name: "核名/新增",
              fontSize: 14,
              color: "#666666",
              offsetY: "8",
              offsetX: "6"
            },
            extra: {
              arcbar: (l = {
                type: "default",
                width: 5,
                backgroundColor: "#E9E9E9",
                startAngle: .75,
                endAngle: .25,
                gap: 2,
                linearType: "none"
              }, e(l, "startAngle", 1), e(l, "endAngle", 0), l)
            }
          })
      } else
        console.error("[uCharts]: 未获取到 context")
    }))
  }
});